﻿namespace App.Services
{
    public class GreetingV3Service : IGreetingService
    {
        private readonly IConfiguration _configuration;
        public GreetingV3Service(IConfiguration configuration) 
        {
            _configuration = configuration.GetSection("greeting");
        }
        public string Greeting(DateTimeOffset time) => time.Hour switch
        {
            var h when h >= 5 && h < 12 => _configuration["morning"],
            var h when h >= 12 && h < 17 => _configuration["afternooning"],
            _ => _configuration["evening"]
        };
    }
}
